<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/12/14
 * Time: 11:12
 */

namespace Home\Controller;


class ProductController extends HomeController
{
    public function index(){
        $cate_id=I("get.cate_id",75,"int");
        $category=D("Category");
        $document=D("Document");
        /*分类列表*/
        $cate_list=$category->getSameLevel($cate_id);
        $this->assign("cate_list",$cate_list);
        //print_r($cate_list);exit;
        //当前分类信息
        $cate_info=$category->getTree($cate_id);
        $this->assign("cate_info",$cate_info);
        /*新闻列表*/

        $product_data=$document->list_page($cate_id,6,null);
        $this->assign("product_data",$product_data);
        //print_r($product_data);exit;

        $this->assign("cate_id",$cate_id);
        $this->assign("meta_title","产品中心");
        $this->display();
    }

    public function detail(){
        $category=D("Category");
        $document=D("Document");
        $id=I("get.id",0,"int");
        $info=$document->detail($id);//分类信息

        /*分类列表*/
        $cate_list=$category->getSameLevel($info['category_id']);
        $this->assign("cate_list",$cate_list);
        //print_r($cate_list);exit;
        //当前分类信息
        $cate_info=$category->getTree($info['category_id']);
        $this->assign("cate_info",$cate_info);


        $this->assign("info",$info);
        $this->assign("meta_title","产品中心");
        $this->display();
    }
}